<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAdminTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('admin', function (Blueprint $table) {
            $table->increments('id')->comment('管理员编号');
            $table->string('name',64)->comment('名称');
            $table->string('email','128')->comment('电子邮箱');
            $table->timestamp('email_verified_at')->nullable()->comment('邮箱验证时间');
            $table->string('password',128)->comment('密码');
            $table->tinyInteger('type')->comment('管理员类型');
            $table->string('phone',64)->comment('手机号');
            $table->tinyInteger('status', false, true)->comment('管理员状态:0无效1有效2暂停');
            $table->timestamps();
            //创建索引
            $table->unique('email');
            $table->index('name');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admin');
    }
}
